﻿@{
    ViewBag.Title = "DanhSach";
    Layout = "~/Views/Shared/MasterAdmin.cshtml";
}
@model List<KM.ENT.entKhuyenMai>
@{
    
    Html.BeginForm();
}
<div class="row">
    <div class="col-lg-12">
        <div class="box">
            <div class="box-header" data-original-title="">
                <h2><i class="fa fa-user"></i><span class="break"></span>Members</h2>
                <div class="box-icon">
                    <a href="table.html#" class="btn-setting"><i class="fa fa-wrench"></i></a>
                    <a href="table.html#" class="btn-minimize"><i class="fa fa-chevron-up"></i></a>
                    <a href="table.html#" class="btn-close"><i class="fa fa-times"></i></a>
                </div>
            </div>
            <div class="box-content">
                <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper form-inline" role="grid">
                    <div class="row">
                        <div class="col-lg-6">
                            <div id="DataTables_Table_0_length" class="dataTables_length">
                                <label>
                                    @Html.DropDownList("lmk", (List<SelectListItem>)ViewBag.stateList, "--chọn lại khuyến mãi--", new { onchange = "this.form.submit()"})
                                    records per page</label>
                            </div>
                        </div>
                        <div class="col-lg-6">
                            <div class="dataTables_filter" id="DataTables_Table_0_filter">
                                <label>
                                    Search:
                                    <input type="text" aria-controls="DataTables_Table_0"></label>
                            </div>
                        </div>
                    </div>
                    <table class="table table-striped table-bordered bootstrap-datatable datatable dataTable" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
                        <thead>
                            <tr role="row">
                                <th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Username: activate to sort column descending">Tiêu đề</th>
                                <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Date registered: activate to sort column ascending">Site Nguồn</th>
                                <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Role: activate to sort column ascending">Ngày tạo</th>
                                <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Status: activate to sort column ascending">Thứ tự</th>
                                <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Status: activate to sort column ascending">Trạng thái</th>
                                <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Actions: activate to sort column ascending">Chức năng</th>
                            </tr>
                        </thead>

                        <tbody id="t" role="alert" aria-live="polite" aria-relevant="all">
                            @{
                                int i = 0;
                                string className = "";
                                foreach (var item in Model)
                                {
                                    i++;
                                    className = (i % 2 == 0 ? "odd" : "even");
                                <tr class="@className">
                                    <td class=" sorting_1">@item.TieuDe</td>
                                    <td class=" ">@item.SiteNguon</td>
                                    <td class=" ">@item.NgaySua</td>
                                    <td class=" ">@item.ThuTu</td>
                                    <td class=" ">
                                        <span class="label label-success">Active</span>
                                    </td>
                                    <td class=" ">
                                        <a class="btn btn-success" href="table.html#">
                                            <i class="fa fa-search-plus "></i>
                                        </a>
                                        <a class="btn btn-info" href="table.html#">
                                            <i class="fa fa-edit "></i>
                                        </a>
                                        <a class="btn btn-danger" href="table.html#">
                                            <i class="fa fa-trash-o "></i>
                                        </a>
                                    </td>
                                </tr>
                                }
                                
                            }

                        </tbody>
                    </table>
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="dataTables_info" id="DataTables_Table_0_info">Showing 1 to 10 of 32 entries</div>
                        </div>
                        <div class="col-lg-12 center">
                            <div class="dataTables_paginate paging_bootstrap">
                                <ul class="pagination">
                                    <li class="prev disabled"><a href="#">← Previous</a></li>
                                    <li class="active"><a href="#">1</a></li>
                                    <li><a href="#">2</a></li>
                                    <li><a href="#">3</a></li>
                                    <li><a href="#">4</a></li>
                                    <li class="next"><a href="#">Next → </a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--/col-->

</div>
@section java
    {
    <!--JavaScript-->
    <script type="text/javascript">
        $(document).ready(function () {
            $("#lmk1").change(function () {
                $.ajax({
                    type: "Post",
                    url: "/KhuyenMai/getKhuyenMaiPartialView",
                    data: { lmk: $("#lmk > option:selected").attr("value") },
                    success: function (viewHTML) {
                        $("#t").html(viewHTML);
                    }
                });
            })
        });

    </script>
}
